package com.google.code.ptrends.catparsers.utils;

public class IntPair {
	private int a;
	private int b;
	private int fHashCode;

	public IntPair(int a, int b) {
		this.a = a;
		this.b = b;
	}

	public void setA(int a) {
		this.a = a;
	}

	public int getA() {
		return a;
	}

	public void setB(int b) {
		this.b = b;
	}

	public int getB() {
		return b;
	}

	@Override
	public int hashCode() {
		if (fHashCode == 0) {
			fHashCode = 7 + 11 * this.a;
			fHashCode ^= 13 * this.b;
		}

		return fHashCode;
	}

	@Override
	public boolean equals(Object arg0) {
		if (arg0 == null)
			return false;

		if (!(arg0 instanceof IntPair))
			return false;

		IntPair obj = (IntPair) arg0;

		return (this.a == obj.getA() && this.b == obj.getB());
	}

	@Override
	public String toString() {
		return a + "-" + b;
	}
}